#include <pcap.h>
#include <stdio.h>

int main()
{
  char errBuf[PCAP_ERRBUF_SIZE], * device;
	pcap_if_t *alldev;
  
	int ret = pcap_findalldevs(&alldev,errBuf);
	if(ret!=0){
	printf("find failed!\n");
	return 0;
	}
  while(alldev)
{
  printf("dev name is:%s\n",alldev->name);
		printf("ip:%s\n", alldev->addresses->addr->sa_data);
	printf("mask:%s\n",alldev->addresses->netmask->sa_data);
	alldev = alldev->next;
}
	pcap_freealldevs(alldev);
  return 0;
}
